$(function () {
    $("body").on("click","#onBack",function () {
        window.location.href = baseloaction +'/admin/op/advert/toQueryOpAdvertPlaceList';
    });

    $("body").on("click","#submitAdvertPlace",function () {
        saveAdvertPlace();
    });
});

/**
 * 保存广告位置数据
 */
function saveAdvertPlace() {
    var params = $("#advertPlaceSaveForm").serializeJSON();
    params = JSON.stringify(params);
    $.ajax({
        url: baseloaction +'/admin/op/advert/saveUpdateOpAdvertPlace',
        type:'post',
        dataType:'json',
        data:params,
        contentType:'application/json;charset=utf-8',
        success:function (result) {
            if(result.success){
                window.location.href = baseloaction +'/admin/op/advert/toQueryOpAdvertPlaceList';
            }else{
                icModale(0, result.message);
            }
        },
        error:function (error) {
            icModale(0, '系统错误，保存广告位置数据失败');
        }
    });
}